var firstInit = true;

PokerIioController = function(app, settings) {
	var ratio = 0.842;
	var resbaseurl = "http://upyun.pokermate.net/handplayer/v2/res/";
	firstInit = false;
	var playerPos = function(_x, _y) {
		this.ins = {
			x : _x + 82 * ratio,
			y : _y +20 * ratio
		}
		this.insText = {
			x : _x + 82 * ratio,
			y : _y +27 * ratio
		}
		this.name = {
			x : _x,
			y : _y - 55 * ratio
		};
		this.icon = {
			x : _x,
			y : _y
		};
		this.chips = {
			x : _x,
			y : _y + 63 * ratio
		};
		this.chipsText = {
			x : _x,
			y : _y + 63 * ratio
		};
		this.pattern = {
			x : _x,
			y : _y + 90 * ratio
		};
		this.dealer = {
			x : _x + 56 * ratio,
			y : _y + 63 * ratio
		};
		this.blind = {
			x : _x + 20 * ratio,
			y : _y - 34 * ratio
		};
		this.bet = {
			x : _x - 30 * ratio,
			y : _y - 80 * ratio
		};
		this.betText = {
			x : _x - 12 * ratio,
			y : _y - 80 * ratio
		};
		this.odds = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.oddsText = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.holecard = [ {
			x : _x - 12 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 12 * ratio,
			y : _y + 5 * ratio
		} ];
		this.holecardGray = [ {
			x : _x - 12 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 12 * ratio,
			y : _y + 5 * ratio
		} ];
		//for omaha
		this.holecardOmaha = [ {
			x : _x - 33 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x - 9 * ratio,
			y : _y + 5 * ratio
		} ,{
			x : _x + 15 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 39 * ratio,
			y : _y + 5 * ratio
		}
		];
		this.holecardGrayOmaha = [ {
			x : _x - 33 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x - 9 * ratio,
			y : _y + 5 * ratio
		} ,{
			x : _x + 15 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 39 * ratio,
			y : _y + 5 * ratio
		}
		];

		this.holecardBlink = [ {
			x : _x - 12 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 12 * ratio,
			y : _y + 5 * ratio
		} ];
		this.holecardNone = {
			x : _x + 12 * ratio,
			y : _y + 18 * ratio
		}
		this.holecardNoneGray = {
			x : _x + 12 * ratio,
			y : _y + 18 * ratio
		}
		this.holecardNoneBlink = {
			x : _x + 12 * ratio,
			y : _y + 18 * ratio
		}
		this.bubble = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.win = {
			x : _x + 0 * ratio,
			y : _y + 31 * ratio
		};
		this.winBg = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.winText = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.rank = {
			x : _x,
			y : _y + 63 * ratio
		};
	}
	var playerPosLeft = function(_x, _y) {
		this.ins = {
			x : _x + 82 * ratio,
			y : _y +20 * ratio
		}
		this.insText = {
			x : _x + 82 * ratio,
			y : _y +27 * ratio
		}
		this.name = {
			x : _x,
			y : _y - 55 * ratio
		};
		this.icon = {
			x : _x,
			y : _y
		};
		this.chips = {
			x : _x,
			y : _y + 63 * ratio
		};
		this.chipsText = {
			x : _x,
			y : _y + 63 * ratio
		};
		this.pattern = {
			x : _x,
			y : _y + 90 * ratio
		};
		this.dealer = {
			x : _x + 56 * ratio,
			y : _y + 63 * ratio
		};
		this.blind = {
			x : _x + 20 * ratio,
			y : _y - 34 * ratio
		};
		this.bet = {
			x : _x + 60 * ratio,
			y : _y + 18 * ratio
		};
		this.betText = {
			x : _x + 78 * ratio,
			y : _y + 17 * ratio
		};
		this.odds = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.oddsText = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.holecard = [ {
			x : _x - 12 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 12 * ratio,
			y : _y + 5 * ratio
		} ];
		this.holecardGray = [ {
			x : _x - 12 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 12 * ratio,
			y : _y + 5 * ratio
		} ];
		//for omaha
		this.holecardOmaha = [ {
			x : _x - 33 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x - 9 * ratio,
			y : _y + 5 * ratio
		} ,{
			x : _x + 15 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 39 * ratio,
			y : _y + 5 * ratio
		}
		];
		this.holecardGrayOmaha = [ {
			x : _x - 33 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x - 9 * ratio,
			y : _y + 5 * ratio
		} ,{
			x : _x + 15 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 39 * ratio,
			y : _y + 5 * ratio
		}
		];
		this.holecardBlink = [ {
			x : _x - 12 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 12 * ratio,
			y : _y + 5 * ratio
		} ];
		this.holecardNone = {
			x : _x + 12 * ratio,
			y : _y + 18 * ratio
		}
		this.holecardNoneGray = {
			x : _x + 12 * ratio,
			y : _y + 18 * ratio
		}
		this.holecardNoneBlink = {
			x : _x + 12 * ratio,
			y : _y + 18 * ratio
		}
		this.bubble = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.win = {
			x : _x + 0 * ratio,
			y : _y + 31 * ratio
		};
		this.winBg = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.winText = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.rank = {
			x : _x,
			y : _y + 63 * ratio
		};
	}
	var playerPosRight = function(_x, _y) {
		this.ins = {
			x : _x - 100 * ratio,
			y : _y +20 * ratio
		}
		this.insText = {
			x : _x - 100 * ratio,
			y : _y +27 * ratio
		}
		this.name = {
			x : _x,
			y : _y - 55 * ratio
		};
		this.icon = {
			x : _x,
			y : _y
		};
		this.chips = {
			x : _x,
			y : _y + 63 * ratio
		};
		this.chipsText = {
			x : _x,
			y : _y + 63 * ratio
		};
		this.pattern = {
			x : _x,
			y : _y + 90 * ratio
		};
		this.dealer = {
			x : _x + 56 * ratio,
			y : _y + 63 * ratio
		};
		this.blind = {
			x : _x + 20 * ratio,
			y : _y - 34 * ratio
		};
		this.bet = {
			x : _x - 120 * ratio,
			y : _y + 18 * ratio
		};
		this.betText = {
			x : _x - 102 * ratio,
			y : _y + 17 * ratio
		};
		this.odds = {
			x : _x - 100 * ratio,
			y : _y - 22 * ratio
		};
		this.oddsText = {
			x : _x - 100 * ratio,
			y : _y - 22 * ratio
		};
		this.holecard = [ {
			x : _x - 12 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 12 * ratio,
			y : _y + 5 * ratio
		} ];
		this.holecardGray = [ {
			x : _x - 12 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 12 * ratio,
			y : _y + 5 * ratio
		} ];
		//for omaha
		this.holecardOmaha = [ {
			x : _x - 33 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x - 9 * ratio,
			y : _y + 5 * ratio
		} ,{
			x : _x + 15 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 39 * ratio,
			y : _y + 5 * ratio
		}
		];
		this.holecardGrayOmaha = [ {
			x : _x - 33 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x - 9 * ratio,
			y : _y + 5 * ratio
		} ,{
			x : _x + 15 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 39 * ratio,
			y : _y + 5 * ratio
		}
		];
		this.holecardBlink = [ {
			x : _x - 12 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 12 * ratio,
			y : _y + 5 * ratio
		} ];
		this.holecardNone = {
			x : _x + 12 * ratio,
			y : _y + 18 * ratio
		}
		this.holecardNoneGray = {
			x : _x + 12 * ratio,
			y : _y + 18 * ratio
		}
		this.holecardNoneBlink = {
			x : _x + 12 * ratio,
			y : _y + 18 * ratio
		}
		this.bubble = {
			x : _x - 82 * ratio,
			y : _y - 22 * ratio
		};
		this.win = {
			x : _x + 0 * ratio,
			y : _y + 31 * ratio
		};
		this.winBg = {
			x : _x - 100 * ratio,
			y : _y - 22 * ratio
		};
		this.winText = {
			x : _x - 100 * ratio,
			y : _y - 22 * ratio
		};
		this.rank = {
			x : _x,
			y : _y + 63 * ratio
		};
	}
	var playerPosUp = function(_x, _y) {
		this.ins = {
			x : _x + 82 * ratio,
			y : _y +20 * ratio
		}
		this.insText = {
			x : _x + 82 * ratio,
			y : _y +27 * ratio
		}
		this.name = {
			x : _x,
			y : _y - 51 * ratio
		};
		this.icon = {
			x : _x,
			y : _y
		};
		this.chips = {
			x : _x,
			y : _y + 63 * ratio
		};
		this.chipsText = {
			x : _x,
			y : _y + 63 * ratio
		};
		this.pattern = {
			x : _x,
			y : _y + 90 * ratio
		};
		this.dealer = {
			x : _x + 56 * ratio,
			y : _y + 63 * ratio
		};
		this.blind = {
			x : _x + 20 * ratio,
			y : _y - 34 * ratio
		};
		this.bet = {
			x : _x - 22 * ratio,
			y : _y + 101 * ratio
		};
		this.betText = {
			x : _x - 4 * ratio,
			y : _y + 101 * ratio
		};
		this.odds = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.oddsText = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.holecard = [ {
			x : _x - 12 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 12 * ratio,
			y : _y + 5 * ratio
		} ];
		this.holecardGray = [ {
			x : _x - 12 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 12 * ratio,
			y : _y + 5 * ratio
		} ];
		//for omaha
		this.holecardOmaha = [ {
			x : _x - 33 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x - 9 * ratio,
			y : _y + 5 * ratio
		} ,{
			x : _x + 15 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 39 * ratio,
			y : _y + 5 * ratio
		}
		];
		this.holecardGrayOmaha = [ {
			x : _x - 33 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x - 9 * ratio,
			y : _y + 5 * ratio
		} ,{
			x : _x + 15 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 39 * ratio,
			y : _y + 5 * ratio
		}
		];
		this.holecardBlink = [ {
			x : _x - 12 * ratio,
			y : _y + 5 * ratio
		}, {
			x : _x + 12 * ratio,
			y : _y + 5 * ratio
		} ];
		this.holecardNone = {
			x : _x + 12 * ratio,
			y : _y + 18 * ratio
		}
		this.holecardNoneGray = {
			x : _x + 12 * ratio,
			y : _y + 18 * ratio
		}
		this.holecardNoneBlink = {
			x : _x + 12 * ratio,
			y : _y + 18 * ratio
		}
		this.bubble = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.win = {
			x : _x + 0 * ratio,
			y : _y + 31 * ratio
		};
		this.winBg = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.winText = {
			x : _x + 82 * ratio,
			y : _y - 22 * ratio
		};
		this.rank = {
			x : _x,
			y : _y + 63 * ratio
		};
	}
	var playerPositions = [ {},
		(new playerPos(375, 415)),
		(new playerPos(193, 415)),
		(new playerPosLeft(65, 298)),
		(new playerPosLeft(65, 142)),
		(new playerPosUp(251, 55)),
		(new playerPosUp(499, 55)),
		(new playerPosRight(685, 142)),
		(new playerPosRight(685, 298)),
		(new playerPos(557, 415)), ];
	var potPosition = {
		x : 375,
		y : 177
	};
	var inspotPosition = {
		x : 680,
		y : 50
	};
	var inspotTextPosition = {
		x : 688,
		y : 50
	};
	var logoPosition = {
		x : 380,
		y : 300
	}
	var boardPositions = [ {
		x : 248,
		y : 244
	}, {
		x : 306,
		y : 244
	}, {
		x : 364,
		y : 244
	}, {
		x : 434,
		y : 244
	}, {
		x : 498,
		y : 244
	} ];
	var iconRadius = 39 * ratio,
	cardScale = {
		x : 67 * ratio,
		y : 96 * ratio
	}, cardScaleSmall = {
		x : 60 * ratio,
		y : 80 * ratio
	}, cardScaleNone = {
		x : 54 * ratio,
		y : 49 * ratio
	},
	bubbleScale = {
		x : 74 * ratio,
		y : 35 * ratio
	}, chipsScale = {
		x : 76 * ratio,
		y : 39 * ratio
	}, betBgScale = {
		x : 30 * ratio,
		y : 30 * ratio
	}, oddsBgScale = {
		x : 70 * ratio,
		y : 31 * ratio
	},insScale = {
		x : 74 * ratio,
		y : 40 * ratio
	};
	function initTable(timeCtr) {
		record = recordHelper.data;
		table = record.STAGE.TABLE;
		seats = table.SEAT;
		pokercard = record.STAGE.POKERCARD;
		for (var i = 0; i < seats.length; i++) {
			if (seats[i].ICON == '') {
				seats[i].ICON = resbaseurl+'icon.png';
			}
			// 头像
			playerPositions[seats[i].NUMBER].icon.obj = new iio.Ellipse({
				// set position to app center
				pos : playerPositions[seats[i].NUMBER].icon,
				// set radius to 25px
				radius : iconRadius,
				// set outline color to green
//				outline : 'white',
				// set line width to 10px
//				lineWidth : 3,
				clip : true,
				img : resbaseurl+'icon.png',
			});
			var img = new Image();
			(function(i){
				img.onload = function(){
					playerPositions[seats[i].NUMBER].icon.obj.set({
					img:seats[i].ICON,
				});
			}
			})(i);
			img.src=seats[i].ICON;
			app.add(playerPositions[seats[i].NUMBER].icon.obj);
			//头像灰度层
			playerPositions[seats[i].NUMBER].icon.gray = new iio.Ellipse({
				// set position to app center
				pos : playerPositions[seats[i].NUMBER].icon,
				radius : iconRadius,
				clip : true,
				img : resbaseurl+'headGray.png',
				hidden : true,
			});
			app.add(playerPositions[seats[i].NUMBER].icon.gray);
			playerPositions[seats[i].NUMBER].icon.gray.actionQueue = [ 0 ];
			playerPositions[seats[i].NUMBER].icon.gray.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].icon.gray.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].icon.gray.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].icon.gray.doAction = function() {
				if (this.currentIndex >= 0
						&& this.currentIndex < this.actionQueue.length) {
					if(this.actionQueue[this.currentIndex]==1){
						this.hidden=false;
					} else {
						this.hidden=true;
					}
				}
			}
			playerPositions[seats[i].NUMBER].icon.gray.currentIndex = 0;
			timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].icon.gray);
			//名字
			playerPositions[seats[i].NUMBER].name.obj = new iio.Text({
				pos: playerPositions[seats[i].NUMBER].name,
				size: 15,
				text: seats[i].NAME,
				color : new iio.Color(99,120,178),
			});
			app.add(playerPositions[seats[i].NUMBER].name.obj);
			// 持有筹码背景
			playerPositions[seats[i].NUMBER].chips.objBG = new iio.Quad({
				pos : playerPositions[seats[i].NUMBER].chips,
				width : chipsScale.x,
				height : chipsScale.y,
				img : resbaseurl+'chips_bg.png'
			});
			playerPositions[seats[i].NUMBER].chips.objBG.actionQueue = [1];
			playerPositions[seats[i].NUMBER].chips.objBG.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].chips.objBG.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].chips.objBG.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].chips.objBG.doAction = function() {
				if (this.currentIndex >= 0
						&& this.currentIndex < this.actionQueue.length) {
							if(this.actionQueue[this.currentIndex] == 1){
								this.set({
									hidden : false,
								});
							} else {
								this.set({
									hidden : true,
								});
							}
				}
			}
			playerPositions[seats[i].NUMBER].chips.objBG.currentIndex = 0;
			timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].chips.objBG);
			app.add(playerPositions[seats[i].NUMBER].chips.objBG);
			// 持有筹码文字
			playerPositions[seats[i].NUMBER].chips.obj = new iio.Text({
				pos : playerPositions[seats[i].NUMBER].chipsText,
				text : recordHelper.chipsFormat(seats[i].CHIPS),
				color : new iio.Color(217,175,109),
				size : 19,
//				font : 'Myriad Pro',
				align : 'center'
			});
			playerPositions[seats[i].NUMBER].chips.obj.chips = Number(seats[i].CHIPS);
			app.add(playerPositions[seats[i].NUMBER].chips.obj);
			playerPositions[seats[i].NUMBER].chips.obj.actionQueue = [ playerPositions[seats[i].NUMBER].chips.obj.chips ];
			playerPositions[seats[i].NUMBER].chips.obj.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].chips.obj.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].chips.obj.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].chips.obj.doAction = function() {
				if (this.currentIndex >= 0
						&& this.currentIndex < this.actionQueue.length) {
							if(Number(this.actionQueue[this.currentIndex])>=0){
								this.chips = this.actionQueue[this.currentIndex];
								this.set({
									text : recordHelper.chipsFormat(this.chips),
									hidden : false,
								});
							} else {
								this.set({
									hidden : true,
								});
							}
				}
			}
			playerPositions[seats[i].NUMBER].chips.obj.currentIndex = 0;
			timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].chips.obj);
			//牌型显示
			playerPositions[seats[i].NUMBER].rank.obj = new iio.Quad({
				pos:playerPositions[seats[i].NUMBER].rank,
				width:  chipsScale.x,
				height: chipsScale.y,
				img:resbaseurl+'RANK_ROYAL_FLUSH.png',
				hidden: true,
			});
			app.add(playerPositions[seats[i].NUMBER].rank.obj);
			playerPositions[seats[i].NUMBER].rank.obj.actionQueue = [''];
			playerPositions[seats[i].NUMBER].rank.obj.forwardAction = function (){
				this.currentIndex++;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].rank.obj.backwardAction = function (){
				this.currentIndex--;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].rank.obj.restart = function(){
				this.currentIndex=0;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].rank.obj.doAction = function (){
				if(this.currentIndex>=0&&this.currentIndex< this.actionQueue.length){
					if(this.actionQueue[this.currentIndex]!=''){
						this.hidden=false;
						this.set({
							img:resbaseurl+''+this.actionQueue[this.currentIndex]+'.png',
							hidden: false,
						});
					} else {
						this.hidden=true;
					}
				}
			}
			playerPositions[seats[i].NUMBER].rank.obj.currentIndex = 0;
			timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].rank.obj);
			// 下注筹码背景
			playerPositions[seats[i].NUMBER].bet.objBG = new iio.Quad({
				pos : playerPositions[seats[i].NUMBER].bet,
				width : betBgScale.x,
				height : betBgScale.y,
				img : resbaseurl+'chip_bet.png',
				hidden : true
			});
			app.add(playerPositions[seats[i].NUMBER].bet.objBG);
			playerPositions[seats[i].NUMBER].bet.objBG.actionQueue = [ 0 ];
			playerPositions[seats[i].NUMBER].bet.objBG.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].bet.objBG.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].bet.objBG.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].bet.objBG.doAction = function() {
				if (this.currentIndex >= 0
						&& this.currentIndex < this.actionQueue.length) {
					if (this.actionQueue[this.currentIndex] == 1) {
						// this.alpha=0.2;
						// this.fade ={
						// speed: -0.05,
						// upperBound: 1,
						// callback: function(o) {
						// o.fade.speed = 0;
						// }
						// };
						this.hidden = false;
					} else {
						this.hidden = true;
					}
				}
			}
			playerPositions[seats[i].NUMBER].bet.objBG.currentIndex = 0;
			timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].bet.objBG);
			// 下注筹码文字
			playerPositions[seats[i].NUMBER].bet.obj = new iio.Text({
				pos : playerPositions[seats[i].NUMBER].betText,
				text : "4",
				width : 1000,
				color : new iio.Color(255, 255,255),
				size : 19,
//				font : 'Myriad Pro',
				align : 'left',
				hidden : true,
			});
			playerPositions[seats[i].NUMBER].bet.obj.chips = Number(0);
			app.add(playerPositions[seats[i].NUMBER].bet.obj);
			playerPositions[seats[i].NUMBER].bet.obj.actionQueue = [ 0 ];
			playerPositions[seats[i].NUMBER].bet.obj.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].bet.obj.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].bet.obj.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].bet.obj.doAction = function() {
				if (this.currentIndex >= 0
						&& this.currentIndex < this.actionQueue.length) {
					if (this.actionQueue[this.currentIndex] == 0) {
						this.hidden = true;
					} else {
						this.chips = this.actionQueue[this.currentIndex];
						this.text = recordHelper.chipsFormat(this.chips);
						// this.alpha=0.2;
						// this.fade ={
						// speed: -0.05,
						// upperBound: 1,
						// callback: function(o) {
						// o.fade.speed = 0;
						// }
						// };
						this.hidden = false;
					}
				}
			}

			playerPositions[seats[i].NUMBER].bet.obj.currentIndex = 0;
			timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].bet.obj);



		}




		// 空位置的头像
		for (i = 1; i < playerPositions.length; i++) {
			if (typeof playerPositions[i].icon.obj == 'undefined') {
				playerPositions[i].icon.obj = new iio.Quad({
					pos : playerPositions[i].icon,
					width : iconRadius * 2,
					height : iconRadius * 2,
					img : resbaseurl+'empty.png'
				});
				app.add(playerPositions[i].icon.obj);
			}
		}
		// Dealer
		if (table.DEALER != "") {
			playerPositions[table.DEALER].dealer.obj = new iio.Quad({
				pos : playerPositions[table.DEALER].dealer,
				width : 20 * ratio,
				height : 20 * ratio,
				img : resbaseurl+'dealer.png'
			});
			app.add(playerPositions[table.DEALER].dealer.obj);
		}
		// pot背景
		potPosition.objBG = new iio.Quad({
			pos : potPosition,
			width : 155 * ratio,
			height : 39 * ratio,
			img : resbaseurl+'pot.png'
		});
		app.add(potPosition.objBG);
		// pot文字
		potPosition.obj = new iio.Text({
			pos : [ potPosition.x , potPosition.y ],
			text : "0",
			color : new iio.Color(255, 255, 255),
			size : 19,
//			font : 'Microsoft YaHei',
			align : 'center',
		});
		potPosition.obj.chips = 0;
		app.add(potPosition.obj);
		potPosition.obj.actionQueue = [ 0 ];
		potPosition.obj.forwardAction = function() {
			this.currentIndex++;
			this.doAction();
		}
		potPosition.obj.backwardAction = function() {
			this.currentIndex--;
			this.doAction();
		}
		potPosition.obj.restart = function() {
			this.currentIndex = 0;
			this.doAction();
		}
		potPosition.obj.doAction = function() {
			if (this.currentIndex >= 0
					&& this.currentIndex < this.actionQueue.length) {
				this.chips = this.actionQueue[this.currentIndex];
				this.text = recordHelper.chipsFormat(this.chips);
			}
		}

		potPosition.obj.currentIndex = 0;
		timeCtr.push2AllObjs(potPosition.obj);
		// 手牌
		var holecard = pokercard.HOLECARD;
		if (typeof holecard.length == 'undefined') {
			holecard = [ holecard ];
		}


		for (var i = 0; i < holecard.length; i++) {
			var cards = holecard[i].CARD.split(' ');
			// 分享者手牌展示
			// 判断收藏者是否在牌局中
			if (cards[0] != '-1') {
				//omaha
				if(table.GAME_TYPE==5){
					// 底牌1
					playerPositions[holecard[i].NUMBER].holecardOmaha[0].obj = new iio.Quad(
							{
								pos : playerPositions[holecard[i].NUMBER].holecardOmaha[0],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/'
										+ cards[0] + '.png'
							});
					app.add(playerPositions[holecard[i].NUMBER].holecardOmaha[0].obj);
					playerPositions[holecard[i].NUMBER].holecardOmaha[0].obj.actionQueue = [ resbaseurl+'card/'
										+ cards[0] + '.png' ];
					playerPositions[holecard[i].NUMBER].holecardOmaha[0].obj.forwardAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[0].obj.backwardAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[0].obj.restart = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[0].obj.doAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[0].obj.currentIndex = 0;
					//底牌1扣牌蒙版
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[0].obj = new iio.Quad(
							{
								pos : playerPositions[holecard[i].NUMBER].holecardOmaha[0],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/poker_gray_mask_small.png',
								hidden: true,
							});
					app.add(playerPositions[holecard[i].NUMBER].holecardGrayOmaha[0].obj);
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[0].obj.actionQueue = [ 0 ];
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[0].obj.forwardAction = function() {
						this.currentIndex++;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[0].obj.backwardAction = function() {
						this.currentInde--;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[0].obj.restart = function() {
						this.currentIndex=0;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[0].obj.doAction = function() {
						if (this.currentIndex >= 0
							&& this.currentIndex < this.actionQueue.length) {
							if(this.actionQueue[this.currentIndex]==1){
								this.hidden=false;
							} else {
								this.hidden=true;
							}
						}
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[0].obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[holecard[i].NUMBER].holecardGrayOmaha[0].obj);
					// 底牌2
					playerPositions[holecard[i].NUMBER].holecardOmaha[1].obj = new iio.Quad(
							{
								pos : playerPositions[holecard[i].NUMBER].holecardOmaha[1],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/'
										+ cards[1] + '.png'
							});
					app.add(playerPositions[holecard[i].NUMBER].holecardOmaha[1].obj);
					playerPositions[holecard[i].NUMBER].holecardOmaha[1].obj.actionQueue = [ resbaseurl+'card/'
										+ cards[1] + '.png' ];
					playerPositions[holecard[i].NUMBER].holecardOmaha[1].obj.forwardAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[1].obj.backwardAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[1].obj.restart = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[1].obj.doAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[1].obj.currentIndex = 0;

					//底牌2扣牌蒙版
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[1].obj = new iio.Quad(
							{
								pos : playerPositions[holecard[i].NUMBER].holecardOmaha[1],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/poker_gray_mask_small.png',
								hidden: true,
							});
					app.add(playerPositions[holecard[i].NUMBER].holecardGrayOmaha[1].obj);
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[1].obj.actionQueue = [ 0 ];
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[1].obj.forwardAction = function() {
						this.currentIndex++;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[1].obj.backwardAction = function() {
						this.currentInde--;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[1].obj.restart = function() {
						this.currentIndex=0;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[1].obj.doAction = function() {
						if (this.currentIndex >= 0
							&& this.currentIndex < this.actionQueue.length) {
							if(this.actionQueue[this.currentIndex]==1){
								this.hidden=false;
							} else {
								this.hidden=true;
							}
						}
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[1].obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[holecard[i].NUMBER].holecardGrayOmaha[1].obj);

					// 底牌3
					playerPositions[holecard[i].NUMBER].holecardOmaha[2].obj = new iio.Quad(
							{
								pos : playerPositions[holecard[i].NUMBER].holecardOmaha[2],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/'
										+ cards[2] + '.png'
							});
					app.add(playerPositions[holecard[i].NUMBER].holecardOmaha[2].obj);
					playerPositions[holecard[i].NUMBER].holecardOmaha[2].obj.actionQueue = [ resbaseurl+'card/'
										+ cards[2] + '.png' ];
					playerPositions[holecard[i].NUMBER].holecardOmaha[2].obj.forwardAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[2].obj.backwardAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[2].obj.restart = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[2].obj.doAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[2].obj.currentIndex = 0;
					//底牌3扣牌蒙版
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[2].obj = new iio.Quad(
							{
								pos : playerPositions[holecard[i].NUMBER].holecardOmaha[2],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/poker_gray_mask_small.png',
								hidden: true,
							});
					app.add(playerPositions[holecard[i].NUMBER].holecardGrayOmaha[2].obj);
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[2].obj.actionQueue = [ 0 ];
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[2].obj.forwardAction = function() {
						this.currentIndex++;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[2].obj.backwardAction = function() {
						this.currentInde--;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[2].obj.restart = function() {
						this.currentIndex=0;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[2].obj.doAction = function() {
						if (this.currentIndex >= 0
							&& this.currentIndex < this.actionQueue.length) {
							if(this.actionQueue[this.currentIndex]==1){
								this.hidden=false;
							} else {
								this.hidden=true;
							}
						}
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[2].obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[holecard[i].NUMBER].holecardGrayOmaha[2].obj);
					// 底牌4
					playerPositions[holecard[i].NUMBER].holecardOmaha[3].obj = new iio.Quad(
							{
								pos : playerPositions[holecard[i].NUMBER].holecardOmaha[3],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/'
										+ cards[3] + '.png'
							});
					app.add(playerPositions[holecard[i].NUMBER].holecardOmaha[3].obj);
					playerPositions[holecard[i].NUMBER].holecardOmaha[3].obj.actionQueue = [ resbaseurl+'card/'
										+ cards[3] + '.png' ];
					playerPositions[holecard[i].NUMBER].holecardOmaha[3].obj.forwardAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[3].obj.backwardAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[3].obj.restart = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[3].obj.doAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecardOmaha[3].obj.currentIndex = 0;

					//底牌4扣牌蒙版
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[3].obj = new iio.Quad(
							{
								pos : playerPositions[holecard[i].NUMBER].holecardOmaha[3],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/poker_gray_mask_small.png',
								hidden: true,
							});
					app.add(playerPositions[holecard[i].NUMBER].holecardGrayOmaha[3].obj);
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[3].obj.actionQueue = [ 0 ];
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[3].obj.forwardAction = function() {
						this.currentIndex++;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[3].obj.backwardAction = function() {
						this.currentInde--;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[3].obj.restart = function() {
						this.currentIndex=0;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[3].obj.doAction = function() {
						if (this.currentIndex >= 0
							&& this.currentIndex < this.actionQueue.length) {
							if(this.actionQueue[this.currentIndex]==1){
								this.hidden=false;
							} else {
								this.hidden=true;
							}
						}
					}
					playerPositions[holecard[i].NUMBER].holecardGrayOmaha[3].obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[holecard[i].NUMBER].holecardGrayOmaha[3].obj);

				}else{
					// 底牌1
					playerPositions[holecard[i].NUMBER].holecard[0].obj = new iio.Quad(
							{
								pos : playerPositions[holecard[i].NUMBER].holecard[0],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/'
										+ cards[0] + '.png'
							});
					app.add(playerPositions[holecard[i].NUMBER].holecard[0].obj);
					playerPositions[holecard[i].NUMBER].holecard[0].obj.actionQueue = [ resbaseurl+'card/'
										+ cards[0] + '.png' ];
					playerPositions[holecard[i].NUMBER].holecard[0].obj.forwardAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecard[0].obj.backwardAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecard[0].obj.restart = function() {
					}
					playerPositions[holecard[i].NUMBER].holecard[0].obj.doAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecard[0].obj.currentIndex = 0;
					//底牌1扣牌蒙版
					playerPositions[holecard[i].NUMBER].holecardGray[0].obj = new iio.Quad(
							{
								pos : playerPositions[holecard[i].NUMBER].holecard[0],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/poker_gray_mask_small.png',
								hidden: true,
							});
					app.add(playerPositions[holecard[i].NUMBER].holecardGray[0].obj);
					playerPositions[holecard[i].NUMBER].holecardGray[0].obj.actionQueue = [ 0 ];
					playerPositions[holecard[i].NUMBER].holecardGray[0].obj.forwardAction = function() {
						this.currentIndex++;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGray[0].obj.backwardAction = function() {
						this.currentInde--;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGray[0].obj.restart = function() {
						this.currentIndex=0;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGray[0].obj.doAction = function() {
						if (this.currentIndex >= 0
							&& this.currentIndex < this.actionQueue.length) {
							if(this.actionQueue[this.currentIndex]==1){
								this.hidden=false;
							} else {
								this.hidden=true;
							}
						}
					}
					playerPositions[holecard[i].NUMBER].holecardGray[0].obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[holecard[i].NUMBER].holecardGray[0].obj);
					// 底牌2
					playerPositions[holecard[i].NUMBER].holecard[1].obj = new iio.Quad(
							{
								pos : playerPositions[holecard[i].NUMBER].holecard[1],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/'
										+ cards[1] + '.png'
							});
					app.add(playerPositions[holecard[i].NUMBER].holecard[1].obj);
					playerPositions[holecard[i].NUMBER].holecard[1].obj.actionQueue = [ resbaseurl+'card/'
										+ cards[1] + '.png' ];
					playerPositions[holecard[i].NUMBER].holecard[1].obj.forwardAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecard[1].obj.backwardAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecard[1].obj.restart = function() {
					}
					playerPositions[holecard[i].NUMBER].holecard[1].obj.doAction = function() {
					}
					playerPositions[holecard[i].NUMBER].holecard[1].obj.currentIndex = 0;

					//底牌2扣牌蒙版
					playerPositions[holecard[i].NUMBER].holecardGray[1].obj = new iio.Quad(
							{
								pos : playerPositions[holecard[i].NUMBER].holecard[1],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/poker_gray_mask_small.png',
								hidden: true,
							});
					app.add(playerPositions[holecard[i].NUMBER].holecardGray[1].obj);
					playerPositions[holecard[i].NUMBER].holecardGray[1].obj.actionQueue = [ 0 ];
					playerPositions[holecard[i].NUMBER].holecardGray[1].obj.forwardAction = function() {
						this.currentIndex++;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGray[1].obj.backwardAction = function() {
						this.currentInde--;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGray[1].obj.restart = function() {
						this.currentIndex=0;
						this.doAction();
					}
					playerPositions[holecard[i].NUMBER].holecardGray[1].obj.doAction = function() {
						if (this.currentIndex >= 0
							&& this.currentIndex < this.actionQueue.length) {
							if(this.actionQueue[this.currentIndex]==1){
								this.hidden=false;
							} else {
								this.hidden=true;
							}
						}
					}
					playerPositions[holecard[i].NUMBER].holecardGray[1].obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[holecard[i].NUMBER].holecardGray[1].obj);
				}

			}
		}
		//omaha
		var imgpai = "pai.png";
		var imgpai_gray = "pai_gray.png";
		if(table.GAME_TYPE==5){
			imgpai = "omaha_pai.png";
			imgpai_gray = "omaha_pai_gray.png";
		}
		// 其他人手牌背面展示
		for (var i = 1; i < playerPositions.length; i++) {

			//omaha
			var holecardObj;
			if(table.GAME_TYPE==5){
				holecardObj = playerPositions[i].holecardOmaha[1].obj;
			}else{
				holecardObj = playerPositions[i].holecard[1].obj;
			}


			if (typeof holecardObj == 'undefined'
					&& typeof playerPositions[i].chips.obj != 'undefined') {
				//扣着的小牌
				playerPositions[i].holecardNone.obj = new iio.Quad(
						{
							pos : playerPositions[i].holecardNone,
							width : cardScaleNone.x,
							height : cardScaleNone.y,
							img : resbaseurl+imgpai,
						});
				app.add(playerPositions[i].holecardNone.obj);
				playerPositions[i].holecardNone.obj.actionQueue = [ 1 ];
				playerPositions[i].holecardNone.obj.forwardAction = function() {
					this.currentIndex++;
					this.doAction();
				}
				playerPositions[i].holecardNone.obj.backwardAction = function() {
					this.currentIndex--;
					this.doAction();
				}
				playerPositions[i].holecardNone.obj.restart = function() {
					this.currentIndex = 0;
					this.doAction();
				}
				playerPositions[i].holecardNone.obj.doAction = function() {
					if (this.currentIndex >= 0
							&& this.currentIndex < this.actionQueue.length) {
						if(this.actionQueue[this.currentIndex]==1){
							this.hidden=false;
						} else {
							this.hidden=true;
						}
					}
				}
			}
			// 添加扣牌的灰度层
			if (typeof playerPositions[i].chips.obj != 'undefined') {
				// 扣牌灰度
				playerPositions[i].holecardNoneGray.obj = new iio.Quad(
						{
							pos : playerPositions[i].holecardNoneGray,
							width : cardScaleNone.x,
							height : cardScaleNone.y,
							img : resbaseurl+imgpai_gray,
							hidden : true
						});
				app.add(playerPositions[i].holecardNoneGray.obj);
				playerPositions[i].holecardNoneGray.obj.actionQueue = [ 0 ];
				playerPositions[i].holecardNoneGray.obj.forwardAction = function() {
					this.currentIndex++;
					this.doAction();
				}
				playerPositions[i].holecardNoneGray.obj.backwardAction = function() {
					this.currentIndex--;
					this.doAction();
				}
				playerPositions[i].holecardNoneGray.obj.restart = function() {
					this.currentIndex = 0;
					this.doAction();
				}
				playerPositions[i].holecardNoneGray.obj.doAction = function() {
					if (this.currentIndex >= 0
							&& this.currentIndex < this.actionQueue.length) {
						if (this.actionQueue[this.currentIndex] == 1) {
							this.hidden = false;
						} else {
							this.hidden = true;
						}
					}
				}
				playerPositions[i].holecardNoneGray.obj.currentIndex = 0;
				timeCtr.push2AllObjs(playerPositions[i].holecardNoneGray.obj);
			}
			//非主视角底牌
			if (typeof holecardObj == 'undefined'
					&& typeof playerPositions[i].chips.obj != 'undefined') {
				//omaha
				if(table.GAME_TYPE==5){
					//底牌1
					playerPositions[i].holecardNone.obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[i].holecardNone.obj);
					playerPositions[i].holecardOmaha[0].obj = new iio.Quad(
							{
								pos : playerPositions[i].holecardOmaha[0],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/1s.png',
								hidden : true,
							});
					app.add(playerPositions[i].holecardOmaha[0].obj);
					playerPositions[i].holecardOmaha[0].obj.actionQueue = [ '' ];
					playerPositions[i].holecardOmaha[0].obj.forwardAction = function() {
						this.currentIndex++;
						this.doAction();
					}
					playerPositions[i].holecardOmaha[0].obj.backwardAction = function() {
						this.currentIndex--;
						this.doAction();
					}
					playerPositions[i].holecardOmaha[0].obj.restart = function() {
						this.currentIndex = 0;
						this.doAction();
					}
					playerPositions[i].holecardOmaha[0].obj.doAction = function() {
						if (this.currentIndex >= 0
								&& this.currentIndex < this.actionQueue.length) {
									if(this.actionQueue[this.currentIndex]!=''){
										this.set({
											img : this.actionQueue[this.currentIndex],
											hidden : false,
										});
									} else {
										this.set({
											hidden : true,
										});
									}

						}
					}

					playerPositions[i].holecardOmaha[0].obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[i].holecardOmaha[0].obj);
					// 底牌2
					playerPositions[i].holecardOmaha[1].obj = new iio.Quad(
							{
								pos : playerPositions[i].holecardOmaha[1],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/1s.png',
								hidden : true,
							});
					app.add(playerPositions[i].holecardOmaha[1].obj);
					playerPositions[i].holecardOmaha[1].obj.actionQueue = [ '' ];
					playerPositions[i].holecardOmaha[1].obj.forwardAction = function() {
						this.currentIndex++;
						this.doAction();
					}
					playerPositions[i].holecardOmaha[1].obj.backwardAction = function() {
						this.currentIndex--;
						this.doAction();
					}
					playerPositions[i].holecardOmaha[1].obj.restart = function() {
						this.currentIndex = 0;
						this.doAction();
					}
					playerPositions[i].holecardOmaha[1].obj.doAction = function() {
						if (this.currentIndex >= 0
								&& this.currentIndex < this.actionQueue.length) {
									if(this.actionQueue[this.currentIndex]!=''){
										this.set({
											img : this.actionQueue[this.currentIndex],
											hidden : false,
										});
									} else {
										this.set({
											hidden : true,
										});
									}
						}
					}

					playerPositions[i].holecardOmaha[1].obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[i].holecardOmaha[1].obj);

					//底牌3
					playerPositions[i].holecardOmaha[2].obj = new iio.Quad(
							{
								pos : playerPositions[i].holecardOmaha[2],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/1s.png',
								hidden : true,
							});
					app.add(playerPositions[i].holecardOmaha[2].obj);
					playerPositions[i].holecardOmaha[2].obj.actionQueue = [ '' ];
					playerPositions[i].holecardOmaha[2].obj.forwardAction = function() {
						this.currentIndex++;
						this.doAction();
					}
					playerPositions[i].holecardOmaha[2].obj.backwardAction = function() {
						this.currentIndex--;
						this.doAction();
					}
					playerPositions[i].holecardOmaha[2].obj.restart = function() {
						this.currentIndex = 0;
						this.doAction();
					}
					playerPositions[i].holecardOmaha[2].obj.doAction = function() {
						if (this.currentIndex >= 0
								&& this.currentIndex < this.actionQueue.length) {
									if(this.actionQueue[this.currentIndex]!=''){
										this.set({
											img : this.actionQueue[this.currentIndex],
											hidden : false,
										});
									} else {
										this.set({
											hidden : true,
										});
									}

						}
					}

					playerPositions[i].holecardOmaha[2].obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[i].holecardOmaha[2].obj);
					// 底牌4
					playerPositions[i].holecardOmaha[3].obj = new iio.Quad(
							{
								pos : playerPositions[i].holecardOmaha[3],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/1s.png',
								hidden : true,
							});
					app.add(playerPositions[i].holecardOmaha[3].obj);
					playerPositions[i].holecardOmaha[3].obj.actionQueue = [ '' ];
					playerPositions[i].holecardOmaha[3].obj.forwardAction = function() {
						this.currentIndex++;
						this.doAction();
					}
					playerPositions[i].holecardOmaha[3].obj.backwardAction = function() {
						this.currentIndex--;
						this.doAction();
					}
					playerPositions[i].holecardOmaha[3].obj.restart = function() {
						this.currentIndex = 0;
						this.doAction();
					}
					playerPositions[i].holecardOmaha[3].obj.doAction = function() {
						if (this.currentIndex >= 0
								&& this.currentIndex < this.actionQueue.length) {
									if(this.actionQueue[this.currentIndex]!=''){
										this.set({
											img : this.actionQueue[this.currentIndex],
											hidden : false,
										});
									} else {
										this.set({
											hidden : true,
										});
									}
						}
					}

					playerPositions[i].holecardOmaha[3].obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[i].holecardOmaha[3].obj);
				}else{
					//底牌1
					playerPositions[i].holecardNone.obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[i].holecardNone.obj);
					playerPositions[i].holecard[0].obj = new iio.Quad(
							{
								pos : playerPositions[i].holecard[0],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/1s.png',
								hidden : true,
							});
					app.add(playerPositions[i].holecard[0].obj);
					playerPositions[i].holecard[0].obj.actionQueue = [ '' ];
					playerPositions[i].holecard[0].obj.forwardAction = function() {
						this.currentIndex++;
						this.doAction();
					}
					playerPositions[i].holecard[0].obj.backwardAction = function() {
						this.currentIndex--;
						this.doAction();
					}
					playerPositions[i].holecard[0].obj.restart = function() {
						this.currentIndex = 0;
						this.doAction();
					}
					playerPositions[i].holecard[0].obj.doAction = function() {
						if (this.currentIndex >= 0
								&& this.currentIndex < this.actionQueue.length) {
									if(this.actionQueue[this.currentIndex]!=''){
										this.set({
											img : this.actionQueue[this.currentIndex],
											hidden : false,
										});
									} else {
										this.set({
											hidden : true,
										});
									}

						}
					}

					playerPositions[i].holecard[0].obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[i].holecard[0].obj);
					// 底牌2
					playerPositions[i].holecard[1].obj = new iio.Quad(
							{
								pos : playerPositions[i].holecard[1],
								width : cardScaleSmall.x,
								height : cardScaleSmall.y,
								img : resbaseurl+'card/1s.png',
								hidden : true,
							});
					app.add(playerPositions[i].holecard[1].obj);
					playerPositions[i].holecard[1].obj.actionQueue = [ '' ];
					playerPositions[i].holecard[1].obj.forwardAction = function() {
						this.currentIndex++;
						this.doAction();
					}
					playerPositions[i].holecard[1].obj.backwardAction = function() {
						this.currentIndex--;
						this.doAction();
					}
					playerPositions[i].holecard[1].obj.restart = function() {
						this.currentIndex = 0;
						this.doAction();
					}
					playerPositions[i].holecard[1].obj.doAction = function() {
						if (this.currentIndex >= 0
								&& this.currentIndex < this.actionQueue.length) {
									if(this.actionQueue[this.currentIndex]!=''){
										this.set({
											img : this.actionQueue[this.currentIndex],
											hidden : false,
										});
									} else {
										this.set({
											hidden : true,
										});
									}
						}
					}

					playerPositions[i].holecard[1].obj.currentIndex = 0;
					timeCtr.push2AllObjs(playerPositions[i].holecard[1].obj);
				}

			}
		};
		// 玩家动作显示的气泡
		for (var i = 0; i < seats.length; i++) {


			//allin概率背景
			playerPositions[seats[i].NUMBER].odds.objBG = [];
			playerPositions[seats[i].NUMBER].odds.objBG.high = new iio.Quad({
				pos : playerPositions[seats[i].NUMBER].odds,
				width : oddsBgScale.x,
				height : oddsBgScale.y,
				img : resbaseurl+'odds_allin_high.png',
				hidden : true
			});
			playerPositions[seats[i].NUMBER].odds.objBG.low = new iio.Quad({
				pos : playerPositions[seats[i].NUMBER].odds,
				width : oddsBgScale.x,
				height : oddsBgScale.y,
				img : resbaseurl+'odds_allin_low.png',
				hidden : true
			});
			app.add(playerPositions[seats[i].NUMBER].odds.objBG.high);
			app.add(playerPositions[seats[i].NUMBER].odds.objBG.low);
			playerPositions[seats[i].NUMBER].odds.objBG.actionQueue = [ 0 ];
			playerPositions[seats[i].NUMBER].odds.objBG.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].odds.objBG.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].odds.objBG.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].odds.objBG.doAction = function() {
				if (this.currentIndex >= 0
						&& this.currentIndex < this.actionQueue.length) {
					//0:无；1:high；2:low
					switch (this.actionQueue[this.currentIndex]) {
						case 0: //隐藏
							this.high.hidden = true;
							this.low.hidden = true;
							break;
						case 1: //高概率
							this.high.hidden = false;
							this.low.hidden = true;
							break;
						case 2://低概率
							this.high.hidden = true;
							this.low.hidden = false;
							break;
					}
				}
			}
			playerPositions[seats[i].NUMBER].odds.objBG.currentIndex = 0;
			timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].odds.objBG);
			//allin概率文字
			playerPositions[seats[i].NUMBER].odds.obj = [];
			playerPositions[seats[i].NUMBER].odds.obj.high = new iio.Text({
				pos : playerPositions[seats[i].NUMBER].oddsText,
				text : "85%",
				color : new iio.Color(255,220,165),
				size : 19,
//				font : 'Myriad Pro',
				align : 'center',
				hidden : true,
			});
			playerPositions[seats[i].NUMBER].odds.obj.low = new iio.Text({
				pos : playerPositions[seats[i].NUMBER].oddsText,
				text : "15%",
				color : new iio.Color(67,89,151),
				size : 19,
//				font : 'Myriad Pro',
				align : 'center',
				hidden : true,
			});
//			playerPositions[seats[i].NUMBER].odds.obj.percent = new iio.Text({
//				pos : [playerPositions[seats[i].NUMBER].oddsText.x+17,playerPositions[seats[i].NUMBER].oddsText.y],
//				text : "%",
//				color : new iio.Color(255,255,255),
//				size : 14,
//				align : 'left',
//				hidden : true,
//			});
			app.add(playerPositions[seats[i].NUMBER].odds.obj.high);
			app.add(playerPositions[seats[i].NUMBER].odds.obj.low);
//			app.add(playerPositions[seats[i].NUMBER].odds.obj.percent);
			playerPositions[seats[i].NUMBER].odds.obj.actionQueue = [ -111 ];
			playerPositions[seats[i].NUMBER].odds.obj.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].odds.obj.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].odds.obj.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].odds.obj.doAction = function() {
				if (this.currentIndex >= 0
						&& this.currentIndex < this.actionQueue.length) {
					//-1:不显示；<50:显示low；>=50:显示high
					if(this.actionQueue[this.currentIndex]==-111){
						this.high.hidden = true;
						this.low.hidden = true;
//						this.percent.hidden = true;
					} else if (this.actionQueue[this.currentIndex]<0){
						this.low.text = -this.actionQueue[this.currentIndex]+'%';
						this.low.hidden = false;
						this.high.hidden = true;
//						this.percent.color = new iio.Color(67,89,151);
//						this.percent.hidden = false;
					} else if (this.actionQueue[this.currentIndex]<=100){
						this.high.text = this.actionQueue[this.currentIndex]+'%';
						this.high.hidden = false;
						this.low.hidden = true;
//						this.percent.color = new iio.Color(255,220,165);
//						this.percent.hidden = false;
					} else {
						this.high.hidden = true;
//						this.low.hidden = true;
//						this.percent.hidden = true;
					}
				}
			}
			playerPositions[seats[i].NUMBER].odds.obj.currentIndex = 0;
			timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].odds.obj);



			//动作气泡
			playerPositions[seats[i].NUMBER].bubble.obj = new iio.Quad({
				pos : playerPositions[i + 1].bubble,
				width : bubbleScale.x,
				height : bubbleScale.y,
				img : resbaseurl+'action_call.png',
				hidden : true,
			});
			app.add(playerPositions[seats[i].NUMBER].bubble.obj);
			playerPositions[seats[i].NUMBER].bubble.obj.x = playerPositions[seats[i].NUMBER].bubble.x;
			playerPositions[seats[i].NUMBER].bubble.obj.y = playerPositions[seats[i].NUMBER].bubble.y;
			playerPositions[seats[i].NUMBER].bubble.obj.actionQueue = [ 0 ];
			playerPositions[seats[i].NUMBER].bubble.obj.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].bubble.obj.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].bubble.obj.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].bubble.obj.doAction = function() {
				if (this.currentIndex >= 0
						&& this.currentIndex < this.actionQueue.length) {
//					this.set({
//						pos : [ this.x, this.y ],
//						vel : [ 0, 0 ],
//						bounds : {},
//					});
					switch (this.actionQueue[this.currentIndex]) {
					case 0:// none
						this.hidden = true;
						break;
					case 1:// call
						this
								.set({
									img : resbaseurl+'action_call.png'
								});
						this.hidden = false;
						break;
					case 2:// raise
						this
								.set({
									img : resbaseurl+'action_raise.png'
								});
						this.hidden = false;
						break;
					case 3:// check
						this
								.set({
									img : resbaseurl+'action_check.png'
								});
						this.hidden = false;
						break;
					case 4:// allin
						this
								.set({
									img : resbaseurl+'action_allin.png'
								});
						this.hidden = false;
						break;
					case 5:// fold
						this
								.set({
									img : resbaseurl+'action_fold.png'
								});
						this.hidden = false;
						break;
					case 6:// straddle
						this
								.set({
									img : resbaseurl+'action_straddle.png'
								});
						this.hidden = false;
						break;
					}
//					if (this.actionQueue[this.currentIndex] > 0) {
//						var cy = Number(this.pos.y);
//						var cx = Number(this.pos.x);
//
//						// (function(o){
//						this.set({
//							pos : [ this.x, this.y + 15 ],
//							vel : [ 0, -3 ],
//							bounds : {
//								top : {
//									bound : this.y - 30,
//									callback : function(o) {
//										o.set({
//											vel : [ 0, 0 ],
//											pos : [ o.x, o.y ],
//											bounds : {},
//										});
//									}
//								}
//							}
//						});
//						// })(this);
//						// alert(this.boundTop)
//
//					}
				}
			}
			playerPositions[seats[i].NUMBER].bubble.obj.currentIndex = 0;
			timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].bubble.obj);
		}


		for (var i = 0; i < seats.length; i++) {
			// 获胜动画空壳，动画在加载完sprite后设置
			playerPositions[seats[i].NUMBER].win.objBg = app.add(new iio.Quad({
		        pos: playerPositions[seats[i].NUMBER].win , // mario position
		        height: 51,
		        width: 86,
		        imageRounding: true, // prevent off center rendering
		        hidden : true,
		        img: resbaseurl + "win1.png",
	    	})
	    	,true);

    		app.add(playerPositions[seats[i].NUMBER].win.objBg);
			playerPositions[seats[i].NUMBER].win.objBg.actionQueue = [ 0 ];
			playerPositions[seats[i].NUMBER].win.objBg.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].win.objBg.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].win.objBg.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].win.objBg.doAction = function() {
				if (this.currentIndex >= 0
						&& this.currentIndex < this.actionQueue.length) {
					if(this.actionQueue[this.currentIndex] == 1){
						this.hidden = false;
					} else {
						this.hidden = true;
					}
				}
			}
			playerPositions[seats[i].NUMBER].win.objBg.currentIndex = 0;
			timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].win.objBg);

			// 获得筹码背景
			playerPositions[seats[i].NUMBER].winBg.obj = new iio.Quad({
				pos : playerPositions[seats[i].NUMBER].winBg,
				width : oddsBgScale.x,
				height : oddsBgScale.y,
				img : resbaseurl+'winBg.png',
				hidden : true
			});
			app.add(playerPositions[seats[i].NUMBER].winBg.obj);
			playerPositions[seats[i].NUMBER].winBg.obj.actionQueue = [ 0 ];
			playerPositions[seats[i].NUMBER].winBg.obj.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].winBg.obj.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].winBg.obj.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].winBg.obj.doAction = function() {
				if (this.currentIndex >= 0
						&& this.currentIndex < this.actionQueue.length) {
							if(this.actionQueue[this.currentIndex] == 1){
								this.hidden = false;
							} else {
								this.hidden = true;
							}
				}
			}
			playerPositions[seats[i].NUMBER].winBg.obj.currentIndex = 0;
			timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].winBg.obj);
			//获得筹码文字
			playerPositions[seats[i].NUMBER].winText.obj = new iio.Text({
				pos : playerPositions[seats[i].NUMBER].oddsText,
				text : "+250",
				color : new iio.Color(0,0,0),
				size : 19,
//				font : 'Myriad Pro',
				align : 'center',
				hidden : true,
			});
			app.add(playerPositions[seats[i].NUMBER].winText.obj);
			playerPositions[seats[i].NUMBER].winText.obj.actionQueue = [ -1 ];
			playerPositions[seats[i].NUMBER].winText.obj.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].winText.obj.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].winText.obj.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			playerPositions[seats[i].NUMBER].winText.obj.doAction = function() {
				if (this.currentIndex >= 0
						&& this.currentIndex < this.actionQueue.length) {
							if(this.actionQueue[this.currentIndex] >= 0){
								if(this.actionQueue[this.currentIndex]>0){
									this.set({
										text : '+'+ recordHelper.chipsFormat(this.actionQueue[this.currentIndex]),
										hidden : false,
									});
								} else {
									this.set({
										text : recordHelper.chipsFormat(this.actionQueue[this.currentIndex]),
										hidden : false,
									});
								}
							} else {
								this.hidden = true;
							}
				}
			}
			playerPositions[seats[i].NUMBER].winText.obj.currentIndex = 0;
			timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].winText.obj);
		}
//		// 玩家获胜显示
//		var spriteMap = new iio.SpriteMap(resbaseurl+'win-map-842.png',
//		    function(){
//		    	for (var i = 0; i < seats.length; i++) {
//		    		playerPositions[seats[i].NUMBER].win.objBg.anims =
//					[
//						spriteMap.sprite({
//					    width: 136 * ratio,
//					    height: 80 * ratio,
//					    name: 'blinking',
//					    origin: [0,0],
//					    numFrames: 4,
//		      		  	}),
//	    			];
//  			playerPositions[seats[i].NUMBER].win.objBg.playAnim({ fps:6, name: 'blinking' });
//
//		    	}
//			}
//		);
		// 公共牌
		for (var i = 0; i < 5; i++) {
			boardPositions[i].obj = new iio.Quad({
				pos : boardPositions[i],
				width : cardScale.x,
				height : cardScale.y,
				img : resbaseurl+'card/1s.png',
				hidden : true,
			});
			app.add(boardPositions[i].obj);
			boardPositions[i].obj.actionQueue = [ '' ];
			boardPositions[i].obj.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			boardPositions[i].obj.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			boardPositions[i].obj.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			boardPositions[i].obj.doAction = function() {
				if(this.currentIndex>=0&&this.currentIndex< this.actionQueue.length){
					if(this.actionQueue[this.currentIndex]!=''){
						this.set({
							img: resbaseurl+'card/'+this.actionQueue[this.currentIndex]+'.png',
						});
						this.hidden=false;
					} else {
						this.hidden=true;
					}
				}
			}
			boardPositions[i].obj.currentIndex = 0;
			timeCtr.push2AllObjs(boardPositions[i].obj);
		}

		//保险局
		if(table.isIns==1){
			//保险pot背景
			inspotPosition.objBG = new iio.Quad({
				pos : inspotPosition,
				width : 130 * ratio,
				height : 39 * ratio,
				img : resbaseurl+'inspot.png'
			});
			app.add(inspotPosition.objBG);
			//保险pot文字
			inspotPosition.obj = new iio.Text({
				pos : inspotTextPosition,
				text : "0",
				color : new iio.Color(255, 255, 255),
				size : 19,
				align : 'center',
			});
			inspotPosition.obj.chips = 0;
			app.add(inspotPosition.obj);

			inspotPosition.obj.actionQueue = [ 0 ];
			inspotPosition.obj.forwardAction = function() {
				this.currentIndex++;
				this.doAction();
			}
			inspotPosition.obj.backwardAction = function() {
				this.currentIndex--;
				this.doAction();
			}
			inspotPosition.obj.restart = function() {
				this.currentIndex = 0;
				this.doAction();
			}
			inspotPosition.obj.doAction = function() {
				if (this.currentIndex >= 0
						&& this.currentIndex < this.actionQueue.length) {
					this.chips = this.actionQueue[this.currentIndex];
					this.text = recordHelper.chipsFormat(this.chips);
				}
			}

			inspotPosition.obj.currentIndex = 0;
			timeCtr.push2AllObjs(inspotPosition.obj);


			for (var i = 0; i < seats.length; i++) {
				// 保险背景
				playerPositions[seats[i].NUMBER].ins.objBG = new iio.Quad({
					pos : playerPositions[seats[i].NUMBER].ins,
					width : insScale.x,
					height : insScale.y,
					img : resbaseurl+'insure.png',
					hidden : true
				});
				app.add(playerPositions[seats[i].NUMBER].ins.objBG);
				playerPositions[seats[i].NUMBER].ins.objBG.actionQueue = [ 0 ];
				playerPositions[seats[i].NUMBER].ins.objBG.forwardAction = function() {
					this.currentIndex++;
					this.doAction();
				}
				playerPositions[seats[i].NUMBER].ins.objBG.backwardAction = function() {
					this.currentIndex--;
					this.doAction();
				}
				playerPositions[seats[i].NUMBER].ins.objBG.restart = function() {
					this.currentIndex = 0;
					this.doAction();
				}
				playerPositions[seats[i].NUMBER].ins.objBG.doAction = function() {
					if (this.currentIndex >= 0
							&& this.currentIndex < this.actionQueue.length) {
						switch (this.actionQueue[this.currentIndex]) {
						case 0:// none
							this.hidden = true;
							break;
						case 1:// buy
							this
									.set({
										img : resbaseurl+'insure.png'
									});
							this.hidden = false;
							break;
						case 2:// result
							this
									.set({
										img : resbaseurl+'claimed.png'
									});
							this.hidden = false;
							break;

						}
					}
				}
				playerPositions[seats[i].NUMBER].ins.objBG.currentIndex = 0;
				timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].ins.objBG);
				//保险文字
				playerPositions[seats[i].NUMBER].ins.obj = new iio.Text({
					pos : playerPositions[seats[i].NUMBER].insText,
					text : "1.1",
					color : new iio.Color(255, 255,255),
					size : 15,
					align : 'center',
					hidden : true,
				});
				playerPositions[seats[i].NUMBER].ins.obj.chips = Number(1.1);
				app.add(playerPositions[seats[i].NUMBER].ins.obj);
				playerPositions[seats[i].NUMBER].ins.obj.actionQueue = [ 1.1 ];
				playerPositions[seats[i].NUMBER].ins.obj.forwardAction = function() {
					this.currentIndex++;
					this.doAction();
				}
				playerPositions[seats[i].NUMBER].ins.obj.backwardAction = function() {
					this.currentIndex--;
					this.doAction();
				}
				playerPositions[seats[i].NUMBER].ins.obj.restart = function() {
					this.currentIndex = 0;
					this.doAction();
				}
				playerPositions[seats[i].NUMBER].ins.obj.doAction = function() {
					if (this.currentIndex >= 0
							&& this.currentIndex < this.actionQueue.length) {
						if (this.actionQueue[this.currentIndex] == 1.1) {
							this.hidden = true;
						} else {
							this.chips = this.actionQueue[this.currentIndex];
							this.text = recordHelper.chipsFormat(this.chips);
							this.hidden = false;
						}
					}
				}

				playerPositions[seats[i].NUMBER].ins.obj.currentIndex = 0;
				timeCtr.push2AllObjs(playerPositions[seats[i].NUMBER].ins.obj);
			}

		}
		//水印
		if(table.GAME_TYPE==4 || table.GAME_TYPE==5){
			var imglogo = "";
			if(table.GAME_TYPE==4){
				imglogo = "6+logo.png";
			}else if(table.GAME_TYPE==5){
				imglogo = "omaha.png";
			}
			logoPosition.objBG = new iio.Quad({
				pos : logoPosition,
				width : 205 * ratio,
				height : 35 * ratio,
				img : resbaseurl+imglogo
			});
			app.add(logoPosition.objBG);
		}

	}

	function betShow(pos, money) {
		var tempQueue = playerPositions[pos].bet.obj.actionQueue;
		playerPositions[pos].bet.obj.actionQueue
				.push(tempQueue[tempQueue.length - 1] + money);
		playerPositions[pos].bet.objBG.actionQueue
				.push(tempQueue[tempQueue.length - 1] > 0 ? 1 : 0);
		tempQueue = playerPositions[pos].chips.obj.actionQueue;
		playerPositions[pos].chips.obj.actionQueue
				.push(tempQueue[tempQueue.length - 1] - money);
		var actionObjs = [ playerPositions[pos].bet.objBG, playerPositions[pos].bet.obj,
				playerPositions[pos].chips.obj ];
		return actionObjs;
	}

	function blindShow(ctr) {
		// sb
		var actionObjs = betShow(table.SBLIND.NUMBER,
				Number(table.SBLIND.CHIPS));
		//判断allin
		tempQueue = playerPositions[table.SBLIND.NUMBER].chips.obj.actionQueue;
		if(tempQueue[tempQueue.length - 1]<=0){
			actionObjs = actionObjs.concat(bubbleShow(table.SBLIND.NUMBER,4));//4代表allin
		}
		// bb
		actionObjs = actionObjs.concat(betShow(table.BBLIND.NUMBER,
				Number(table.BBLIND.CHIPS)));
		//判断allin
		tempQueue = playerPositions[table.BBLIND.NUMBER].chips.obj.actionQueue;
		if(tempQueue[tempQueue.length - 1]<=0){
			actionObjs = actionObjs.concat(bubbleShow(table.BBLIND.NUMBER,4));//4代表allin
		}
		ctr.add({
			objs : actionObjs,
			during : recordHelper.interval.blindShow,
		});
	}
	/**
	 *
	 * @param {Object}
	 *            pos
	 * @param {Object}
	 *            bubbleType bubbleType 0:none 1：call 2:raise 3:check 4:allin  5:fold  6:straddle
	 *
	 *
	 */

	function bubbleShow(pos, bubbleType) {
		playerPositions[pos].bubble.obj.actionQueue.push(bubbleType);
		return [ playerPositions[pos].bubble.obj ];
	}
	function anteShow(ctr, players){
		if (players) {
			actionObjs = [];
			for (var i = 0; i < players.length; i++) {
				var player = players[i];
				var strs = player.ACTION.split(' ');
				var action = strs[0];
				var money = Number(strs[1]);
				var num = player.NUMBER;
				actionObjs = actionObjs.concat(betShow(num,money));
				//判断allin
				tempQueue = playerPositions[num].chips.obj.actionQueue;
				if(tempQueue[tempQueue.length - 1]<=0){
					actionObjs = actionObjs.concat(bubbleShow(num,4));//4代表allin
				}
			}
			if(players.length>0){
				ctr.add({
					objs : actionObjs,
					during : recordHelper.interval.bet,
				})
			}
		}

	}

	var inspot = 0;

	function insShow(ctr, num, money){
		playerPositions[num].ins.obj.actionQueue.push("-"+money);
		playerPositions[num].ins.objBG.actionQueue.push(1);
		playerPositions[num].bet.obj.actionQueue.push(0);
		playerPositions[num].bet.objBG.actionQueue.push(0);
		var tempQueue =  inspotPosition.obj.actionQueue;
		inspot = tempQueue[tempQueue.length - 1] + money;
	    inspotPosition.obj.actionQueue.push(inspot);

		var actionObjs =[playerPositions[num].ins.obj,playerPositions[num].ins.objBG,inspotPosition.obj,playerPositions[num].bet.obj,playerPositions[num].bet.objBG];
		ctr.add({
			objs : actionObjs,
			during : recordHelper.interval.ins,
		})


	}

	function executeOnePlayer(ctr, num, actionType, money) {
		var actionObjs = bubbleShow(num, actionType);
		actionObjs = actionObjs.concat(betShow(num, money));
		// 弃牌展示
		if (actionType == 5) {
			playerPositions[num].icon.gray.actionQueue.push(1);
				actionObjs = actionObjs.concat([
						playerPositions[num].icon.gray]);
			if(playerPositions[num].holecardNone.obj){
				playerPositions[num].holecardNoneGray.obj.actionQueue.push(1);
				actionObjs = actionObjs.concat([
						playerPositions[num].holecardNoneGray.obj]);

			}else {
				if(typeof playerPositions[num].holecardGray[0].obj != 'undefined'){
					playerPositions[num].holecardGray[0].obj.actionQueue.push(1);
					playerPositions[num].holecardGray[1].obj.actionQueue.push(1);
					actionObjs = actionObjs.concat([
							playerPositions[num].holecardGray[0].obj,
							playerPositions[num].holecardGray[1].obj ]);
				}
				//omaha
				if(typeof playerPositions[num].holecardGrayOmaha[0].obj != 'undefined'){
					playerPositions[num].holecardGrayOmaha[0].obj.actionQueue.push(1);
					playerPositions[num].holecardGrayOmaha[1].obj.actionQueue.push(1);
					playerPositions[num].holecardGrayOmaha[2].obj.actionQueue.push(1);
					playerPositions[num].holecardGrayOmaha[3].obj.actionQueue.push(1);
					actionObjs = actionObjs.concat([
							playerPositions[num].holecardGrayOmaha[0].obj,
							playerPositions[num].holecardGrayOmaha[1].obj,
							playerPositions[num].holecardGrayOmaha[2].obj,
							playerPositions[num].holecardGrayOmaha[3].obj ]);
				}

			}
		}
		ctr.add({
			objs : actionObjs,
			during : recordHelper.interval.bet,
		});
	}

	function showWait(ctr, players){
		actionObjs = [];
		if (players) {
			var showwaitPlayers = [];
			for (var i = 0; i < players.length; i++) {
				var player = players[i];
				var strs = player.ACTION.split(' ');
				var action = strs[0];
				var money = Number(strs[1]);
				if(action=='showwait'){
					showwaitPlayers.push(players[i]);
				}
			}
			if(showwaitPlayers.length>0 && showwaitPlayers.length == players.length){
	//		actionObjs = actionObjs.concat(clearPlayersAction());
				//找概率最大的人
				var maxOdds = 0;
				var maxNum = 0;
				players = showwaitPlayers;
				for(var i = 0;i < players.length; i++){
					if(players[i].ODDS){
						if(Number(players[i].ODDS)>maxOdds){
							maxOdds = Number(players[i].ODDS);
							maxNum = i;
						}
					}
				}
				for (var i = 0; i < players.length; i++) {

					if(typeof players[i].ODDS != 'undefined'){
						playerPositions[players[i].NUMBER].bubble.obj.actionQueue.push(0);
						actionObjs.push(playerPositions[players[i].NUMBER].bubble.obj);
						var odds = Number(players[i].ODDS);
						if(odds<maxOdds){
							playerPositions[players[i].NUMBER].odds.objBG.actionQueue
								.push(2);
							playerPositions[players[i].NUMBER].odds.obj.actionQueue
								.push(-odds);
						} else {
							playerPositions[players[i].NUMBER].odds.objBG.actionQueue
								.push(1);
							playerPositions[players[i].NUMBER].odds.obj.actionQueue
								.push(odds);
						}
						actionObjs.push(playerPositions[players[i].NUMBER].odds.objBG);
						actionObjs.push(playerPositions[players[i].NUMBER].odds.obj);
					}

//					alert(players[i].NUMBER);
					var cards = players[i].CARD.split(' ');
					if(cards.length==2){
						if (cards[0] != '' && playerPositions[players[i].NUMBER].holecard[0].obj.actionQueue.length ==1) {
							playerPositions[players[i].NUMBER].holecard[0].obj.actionQueue
									.push(resbaseurl+'card/'
											+ cards[0] + '.png');
							actionObjs
									.push(playerPositions[players[i].NUMBER].holecard[0].obj);
						}
						if (cards[1] != '' && playerPositions[players[i].NUMBER].holecard[1].obj.actionQueue.length ==1) {
							playerPositions[players[i].NUMBER].holecard[1].obj.actionQueue
									.push(resbaseurl+'card/'
											+ cards[1] + '.png');
							actionObjs
									.push(playerPositions[players[i].NUMBER].holecard[1].obj);
						}
					}
					//omaha
					if(cards.length==4){
						if (cards[0] != '' && playerPositions[players[i].NUMBER].holecardOmaha[0].obj.actionQueue.length ==1) {
							playerPositions[players[i].NUMBER].holecardOmaha[0].obj.actionQueue
									.push(resbaseurl+'card/'
											+ cards[0] + '.png');
							actionObjs
									.push(playerPositions[players[i].NUMBER].holecardOmaha[0].obj);
						}
						if (cards[1] != '' && playerPositions[players[i].NUMBER].holecardOmaha[1].obj.actionQueue.length ==1) {
							playerPositions[players[i].NUMBER].holecardOmaha[1].obj.actionQueue
									.push(resbaseurl+'card/'
											+ cards[1] + '.png');
							actionObjs
									.push(playerPositions[players[i].NUMBER].holecardOmaha[1].obj);
						}
						if (cards[2] != '' && playerPositions[players[i].NUMBER].holecardOmaha[2].obj.actionQueue.length ==1) {
							playerPositions[players[i].NUMBER].holecardOmaha[2].obj.actionQueue
									.push(resbaseurl+'card/'
											+ cards[2] + '.png');
							actionObjs
									.push(playerPositions[players[i].NUMBER].holecardOmaha[2].obj);
						}
						if (cards[3] != '' && playerPositions[players[i].NUMBER].holecardOmaha[3].obj.actionQueue.length ==1) {
							playerPositions[players[i].NUMBER].holecardOmaha[3].obj.actionQueue
									.push(resbaseurl+'card/'
											+ cards[3] + '.png');
							actionObjs
									.push(playerPositions[players[i].NUMBER].holecardOmaha[3].obj);
						}
					}

					if(typeof players[i].RANK != 'undefined'){
						playerPositions[players[i].NUMBER].rank.obj.actionQueue.push(1);
						playerPositions[players[i].NUMBER].rank.rankObj.actionQueue.push(players[i].RANK);
						actionObjs.push(playerPositions[players[i].NUMBER].rank.rankObj);
						actionObjs.push(playerPositions[players[i].NUMBER].rank.obj);
					}

					if(typeof players[i].INSRESULT != 'undefined'){
						playerPositions[players[i].NUMBER].ins.objBG.actionQueue.push(2);
						playerPositions[players[i].NUMBER].ins.obj.actionQueue.push(Number(players[i].INSRESULT));
						var tempQueue =  inspotPosition.obj.actionQueue;
						if(typeof players[i].SYSRESULT != 'undefined'){
				            var temp = inspot;

						    inspotPosition.obj.actionQueue.push(inspot- players[i].SYSRESULT);
							//inspotPosition.obj.actionQueue.push(Number(players[i].SYSRESULT));
						}


						actionObjs.push(playerPositions[players[i].NUMBER].ins.obj);
						actionObjs.push(playerPositions[players[i].NUMBER].ins.objBG);
						actionObjs.push(inspotPosition.obj);


					}

				}
			}
		}
//		ctr.add({
//			objs : actionObjs,
//			during : recordHelper.interval.showWait
//		});
		return actionObjs;
	}


	function executePlayers(ctr, players) {

		if (players) {
			var showwaitPlayers = [];
			for (var i = 0; i < players.length; i++) {
				var player = players[i];
				var strs = player.ACTION.split(' ');
				var action = strs[0];
				var money = Number(strs[1]);
				var actionType = 0;

				switch (action) {
				case 'call':
					actionType = 1;
					break;
				case 'raise':
					actionType = 2;
					break;
				case 'check':
					actionType = 3;
					break;
				case 'allin':
					actionType = 4;
					break;
				case 'fold':
					actionType = 5;
					break;
				case 'straddle':
					actionType = 6;
					break;
				}
				var num = player.NUMBER;
				// allin 判断
				if (playerPositions[num].chips.obj.actionQueue[playerPositions[num].chips.obj.actionQueue.length - 1] <= money) {
					actionType = 4;
				}
				if(action=='showwait'){
					showwaitPlayers.push(players[i]);

				}
				else {
					executeOnePlayer(ctr, num, actionType, money);
				}
			}
			if(showwaitPlayers.length>0 && showwaitPlayers.length<players.length){

				ctr.add({
					objs : showWait(ctr,showwaitPlayers),
					during : recordHelper.interval.showWait
				});

			}

			if(showwaitPlayers.length>0 && showwaitPlayers.length<=players.length){

				for (var i = 0; i < showwaitPlayers.length; i++) {
					var player = showwaitPlayers[i];
					if(typeof player.INSBUY != 'undefined'){
						var money = Number(player.INSBUY);
						var num = player.NUMBER;
						var inspot = player.SYSBUY;
						insShow(ctr, num, money)
					}
				}

			}

		}
	}

	function setPot(money) {
		potPosition.obj.actionQueue.push(money);
		return [ potPosition.obj ];
	}
	function setCommunityCard(pos, card) {
		boardPositions[pos].obj.actionQueue.push(card);
		return [ boardPositions[pos].obj ];
	}

	function clearPlayersAction() {
		var actionObjs = [];
		for (var i = 1; i < playerPositions.length; i++) {
			if (typeof playerPositions[i].chips.obj != 'undefined') {
								// 清空气泡
				//一般轮次开始时allin气泡不清空
				var tempQueue = playerPositions[i].bubble.obj.actionQueue;
				if(tempQueue[tempQueue.length-1]!=4)
					actionObjs = actionObjs.concat(bubbleShow(i, 0));
				// 清空下注
				var tempQueue = playerPositions[i].bet.obj.actionQueue;
				playerPositions[i].bet.obj.actionQueue.push(0);
				playerPositions[i].bet.objBG.actionQueue.push(0);
				actionObjs = actionObjs.concat([ playerPositions[i].bet.obj,
				         						playerPositions[i].bet.objBG]);
				if(typeof playerPositions[i].ins.obj!='undefined'){
					playerPositions[i].ins.obj.actionQueue.push(1.1);
					playerPositions[i].ins.objBG.actionQueue.push(0);
					actionObjs = actionObjs.concat([playerPositions[i].ins.obj,playerPositions[i].ins.objBG]);
				}


			}
		}
		return actionObjs;
	}

	function clearPlayersActionOnShowDownOnly() {
		var actionObjs = [];
		for (var i = 1; i < playerPositions.length; i++) {
			if (typeof playerPositions[i].chips.obj != 'undefined') {
				// 清空气泡
				actionObjs = actionObjs.concat(bubbleShow(i, 0));
				// 清空下注
				var tempQueue = playerPositions[i].bet.obj.actionQueue;
				playerPositions[i].bet.obj.actionQueue.push(0);
				playerPositions[i].bet.objBG.actionQueue.push(0);
				playerPositions[i].odds.obj.actionQueue.push(-111);
				playerPositions[i].odds.objBG.actionQueue.push(0);
				actionObjs = actionObjs.concat([ playerPositions[i].bet.obj,
						playerPositions[i].bet.objBG, playerPositions[i].odds.obj, playerPositions[i].odds.objBG]);
				if(typeof playerPositions[i].ins.obj!='undefined'){
					playerPositions[i].ins.obj.actionQueue.push(1.1);
					playerPositions[i].ins.objBG.actionQueue.push(0);
					actionObjs = actionObjs.concat([playerPositions[i].ins.obj,playerPositions[i].ins.objBG]);
				}
			}
		}
		return actionObjs;
	}

	function preflopShow(ctr, preflop){
		actionObjs = [];
		//收ante
		if(preflop.POT){
			var potMoney = Number(preflop.POT);
			if(potMoney > 0){
				actionObjs = clearPlayersAction();
				actionObjs = actionObjs.concat(setPot(Number(preflop.POT)));
				ctr.add({
					objs : actionObjs,
					during : recordHelper.interval.preFlopShow,
				});
			}
		}
		blindShow(ctr);
		executePlayers(ctr, preflop.PLAYER);
	}

	function flopShow(ctr, flop) {
		var potMoney = Number(flop.POT);
		var cards = flop.CARD.split(' ');
		var players = flop.PLAYER;
		var actionObjs = setPot(potMoney);
		actionObjs = actionObjs.concat(clearPlayersAction());
		actionObjs = actionObjs.concat(setCommunityCard(0, cards[0]));
		actionObjs = actionObjs.concat(setCommunityCard(1, cards[1]));
		actionObjs = actionObjs.concat(setCommunityCard(2, cards[2]));
		actionObjs = actionObjs.concat(showWait(ctr,players));
		ctr.add({
			objs : actionObjs,
			during : recordHelper.interval.flopShow,
		});
		executePlayers(ctr, players);
	}
	function turnShow(ctr, turn) {
		var potMoney = Number(turn.POT);
		var card = turn.CARD;
		var players = turn.PLAYER;
		var actionObjs = setPot(potMoney);
		actionObjs = actionObjs.concat(clearPlayersAction());
		actionObjs = actionObjs.concat(setCommunityCard(3, card));
		actionObjs = actionObjs.concat(showWait(ctr,players));
		ctr.add({
			objs : actionObjs,
			during : recordHelper.interval.turnShow
		});
		executePlayers(ctr, players);
	}
	function riverShow(ctr, river) {
		var potMoney = Number(river.POT);
		var card = river.CARD;
		var players = river.PLAYER;
		var actionObjs = setPot(potMoney);
		actionObjs = actionObjs.concat(clearPlayersAction());
		actionObjs = actionObjs.concat(setCommunityCard(4, card));
		actionObjs = actionObjs.concat(showWait(ctr,players));
		ctr.add({
			objs : actionObjs,
			during : recordHelper.interval.riverShow
		});
		executePlayers(ctr, players);
	}
	function showdown(ctr, showdown) {
		// 清场
		var potMoney = Number(0);
		var actionObjs = setPot(potMoney);
		actionObjs = actionObjs.concat(clearPlayersAction());
		actionObjs = actionObjs.concat(clearPlayersActionOnShowDownOnly());
		var players = showdown.PLAYER;

		for (var i = 0; i < players.length; i++) {
			var strs = players[i].ACTION.split(' ');
			var money = Number(strs[1]);
			// 亮牌
			if (strs[0] != 'noshow') {
				var cards = players[i].CARD.split(' ');
				if(cards.length==2){
					if ( playerPositions[players[i].NUMBER].holecard[0].obj.actionQueue.length == 1) {
						var paiUrl = resbaseurl+'card/'+ 'poker_back_1_small.png'
						if(cards[0] != ''){
							paiUrl = resbaseurl+'card/'+ cards[0] + '.png';
						}
						playerPositions[players[i].NUMBER].holecard[0].obj.actionQueue
								.push(paiUrl);
						actionObjs
								.push(playerPositions[players[i].NUMBER].holecard[0].obj);
					}
					if ( playerPositions[players[i].NUMBER].holecard[1].obj.actionQueue.length == 1) {
						var paiUrl = resbaseurl+'card/'+ 'poker_back_1_small.png'
						if(cards[1] != ''){
							paiUrl = resbaseurl+'card/'+ cards[1] + '.png';
						}
						playerPositions[players[i].NUMBER].holecard[1].obj.actionQueue
								.push(paiUrl);
						actionObjs
								.push(playerPositions[players[i].NUMBER].holecard[1].obj);
					}
				}
				//omaha
				if(cards.length==4){
					if (playerPositions[players[i].NUMBER].holecardOmaha[0].obj.actionQueue.length == 1) {
						var paiUrl = resbaseurl+'card/'+ 'poker_back_1_small.png'
						if(cards[0] != ''){
							paiUrl = resbaseurl+'card/'+ cards[0] + '.png';
						}
						playerPositions[players[i].NUMBER].holecardOmaha[0].obj.actionQueue
								.push(paiUrl);
						actionObjs
								.push(playerPositions[players[i].NUMBER].holecardOmaha[0].obj);
					}
					if (playerPositions[players[i].NUMBER].holecardOmaha[1].obj.actionQueue.length == 1) {
						var paiUrl = resbaseurl+'card/'+ 'poker_back_1_small.png'
						if(cards[1] != ''){
							paiUrl = resbaseurl+'card/'+ cards[1] + '.png';
						}
						playerPositions[players[i].NUMBER].holecardOmaha[1].obj.actionQueue
								.push(paiUrl);
						actionObjs
								.push(playerPositions[players[i].NUMBER].holecardOmaha[1].obj);
					}
					if (playerPositions[players[i].NUMBER].holecardOmaha[2].obj.actionQueue.length == 1) {
						var paiUrl = resbaseurl+'card/'+ 'poker_back_1_small.png'
						if(cards[2] != ''){
							paiUrl = resbaseurl+'card/'+ cards[2] + '.png';
						}
						playerPositions[players[i].NUMBER].holecardOmaha[2].obj.actionQueue
								.push(paiUrl);
						actionObjs
								.push(playerPositions[players[i].NUMBER].holecardOmaha[2].obj);
					}
					if (playerPositions[players[i].NUMBER].holecardOmaha[3].obj.actionQueue.length == 1) {
						var paiUrl = resbaseurl+'card/'+ 'poker_back_1_small.png'
						if(cards[3] != ''){
							paiUrl = resbaseurl+'card/'+ cards[3] + '.png';
						}
						playerPositions[players[i].NUMBER].holecardOmaha[3].obj.actionQueue
								.push(paiUrl);
						actionObjs
								.push(playerPositions[players[i].NUMBER].holecardOmaha[3].obj);
					}
				}

				if(typeof players[i].RANK != 'undefined'){
					playerPositions[players[i].NUMBER].rank.obj.actionQueue.push(players[i].RANK);
					playerPositions[players[i].NUMBER].chips.obj.actionQueue.push(-1);
					actionObjs.push(playerPositions[players[i].NUMBER].rank.obj);
					actionObjs.push(playerPositions[players[i].NUMBER].chips.obj);
				}
			}
			moneyShowed = false;
			if (strs[0] == 'win' || strs[0] == 'noshow') {
				playerPositions[players[i].NUMBER].win.objBg.actionQueue
						.push(1);
				actionObjs.push(playerPositions[players[i].NUMBER].win.objBg);
				playerPositions[players[i].NUMBER].winBg.obj.actionQueue.push(1);
				playerPositions[players[i].NUMBER].winText.obj.actionQueue.push(money);
				actionObjs.push(playerPositions[players[i].NUMBER].winBg.obj);
				actionObjs.push(playerPositions[players[i].NUMBER].winText.obj);
				moneyShowed = true;
			}
			if (money > 0 && !moneyShowed) {
				playerPositions[players[i].NUMBER].winBg.obj.actionQueue.push(1);
				playerPositions[players[i].NUMBER].winText.obj.actionQueue.push(money);
				actionObjs.push(playerPositions[players[i].NUMBER].winBg.obj);
				actionObjs.push(playerPositions[players[i].NUMBER].winText.obj);
			}
		}

		ctr.add({
			objs : actionObjs,
			during : recordHelper.interval.showDown
		});
	}
	//手动亮牌阶段展示
	function showCard(ctr, showcard) {
		// 清场
		var actionObjs = [];
		var players = showcard.PLAYER;

		for (var i = 0; i < players.length; i++) {
			var strs = players[i].ACTION.split(' ');
			var money = Number(strs[1]);
			// 亮牌
			if (strs[0] != 'noshow') {
				var cards = players[i].CARD.split(' ');
				if(cards.length==2){
					if ( playerPositions[players[i].NUMBER].holecard[0].obj.actionQueue.length == 1) {
						var paiUrl = resbaseurl+'card/'+ 'poker_back_1_small.png'
						if(cards[0] != ''){
							paiUrl = resbaseurl+'card/'+ cards[0] + '.png';
						}
						playerPositions[players[i].NUMBER].holecard[0].obj.actionQueue
								.push(paiUrl);
						actionObjs
								.push(playerPositions[players[i].NUMBER].holecard[0].obj);
					}
					if ( playerPositions[players[i].NUMBER].holecard[1].obj.actionQueue.length == 1) {
						var paiUrl = resbaseurl+'card/'+ 'poker_back_1_small.png'
						if(cards[1] != ''){
							paiUrl = resbaseurl+'card/'+ cards[1] + '.png';
						}
						playerPositions[players[i].NUMBER].holecard[1].obj.actionQueue
								.push(paiUrl);
						actionObjs
								.push(playerPositions[players[i].NUMBER].holecard[1].obj);
					}
				}
				//omaha
				if(cards.length==4){
					if (playerPositions[players[i].NUMBER].holecardOmaha[0].obj.actionQueue.length == 1) {
						var paiUrl = resbaseurl+'card/'+ 'poker_back_1_small.png'
						if(cards[0] != ''){
							paiUrl = resbaseurl+'card/'+ cards[0] + '.png';
						}
						playerPositions[players[i].NUMBER].holecardOmaha[0].obj.actionQueue
								.push(paiUrl);
						actionObjs
								.push(playerPositions[players[i].NUMBER].holecardOmaha[0].obj);
					}
					if (playerPositions[players[i].NUMBER].holecardOmaha[1].obj.actionQueue.length == 1) {
						var paiUrl = resbaseurl+'card/'+ 'poker_back_1_small.png'
						if(cards[1] != ''){
							paiUrl = resbaseurl+'card/'+ cards[1] + '.png';
						}
						playerPositions[players[i].NUMBER].holecardOmaha[1].obj.actionQueue
								.push(paiUrl);
						actionObjs
								.push(playerPositions[players[i].NUMBER].holecardOmaha[1].obj);
					}
					if (playerPositions[players[i].NUMBER].holecardOmaha[2].obj.actionQueue.length == 1) {
						var paiUrl = resbaseurl+'card/'+ 'poker_back_1_small.png'
						if(cards[2] != ''){
							paiUrl = resbaseurl+'card/'+ cards[2] + '.png';
						}
						playerPositions[players[i].NUMBER].holecardOmaha[2].obj.actionQueue
								.push(paiUrl);
						actionObjs
								.push(playerPositions[players[i].NUMBER].holecardOmaha[2].obj);
					}
					if (playerPositions[players[i].NUMBER].holecardOmaha[3].obj.actionQueue.length == 1) {
						var paiUrl = resbaseurl+'card/'+ 'poker_back_1_small.png'
						if(cards[3] != ''){
							paiUrl = resbaseurl+'card/'+ cards[3] + '.png';
						}
						playerPositions[players[i].NUMBER].holecardOmaha[3].obj.actionQueue
								.push(paiUrl);
						actionObjs
								.push(playerPositions[players[i].NUMBER].holecardOmaha[3].obj);
					}
				}

				if(typeof players[i].RANK != 'undefined'){
					playerPositions[players[i].NUMBER].rank.obj.actionQueue.push(players[i].RANK);
					playerPositions[players[i].NUMBER].chips.obj.actionQueue.push(-1);
					actionObjs.push(playerPositions[players[i].NUMBER].rank.obj);
					actionObjs.push(playerPositions[players[i].NUMBER].chips.obj);
				}
			}
		}

		ctr.add({
			objs : actionObjs,
			during : recordHelper.interval.showDown
		});
	}
	function endWait(ctr) {
		ctr.add({
			objs : [],
			during : recordHelper.interval.end
		});
	}

	function parseLog() {

	}

	var timeCtr = new TimeControl();

	initTable(timeCtr);
	anteShow(timeCtr,recordHelper.data.STAGE.TABLE.ANTE);
	if(typeof pokercard.PREFLOP != 'undefined'){
		preflopShow(timeCtr, pokercard.PREFLOP);
		if (typeof pokercard.FLOP != 'undefined') {
			flopShow(timeCtr, pokercard.FLOP);
			if (typeof pokercard.TURN != 'undefined') {
				turnShow(timeCtr, pokercard.TURN);
				if (typeof pokercard.RIVER != 'undefined') {
					riverShow(timeCtr, pokercard.RIVER);
				}
			}
		}
	}
	if (typeof record.STAGE.SHOWDOWN != 'undefined') {
		showdown(timeCtr, record.STAGE.SHOWDOWN);
	}
	if (typeof record.STAGE.SHOWCARD != 'undefined'){
		showCard(timeCtr,record.STAGE.SHOWCARD);
	}
	endWait(timeCtr);

	recordHelper.play = function() {
		timeCtr.start();
	}
	recordHelper.replay = function() {
		timeCtr.restart();
	}
	recordHelper.forward = function() {
		timeCtr.forward();
	}
	recordHelper.backward = function() {
		timeCtr.backward();
	}
	recordHelper.pause = function() {
		timeCtr.pause();
	}

	timeCtr.start();
	var timerOn = true;
	var timerCounter = 0;
	var timerDuring = 1;
	app.loop(10);
	app.onUpdate = function(o) {
		if (timerOn) {
			if (timerDuring > 0 && timerCounter < timerDuring) {
				timerCounter++;
			} else {
				timerCounter = 0;
				timeCtr.onUp();
			}
		}
	}
	var progressBarBg = new iio.Line({
		color : new iio.Color(102, 100, 100),
		// set width to 10px
		width : 6,
		// set vertices relative to pos
		vs : [
		// start vertex position
		[ 0, 560 ],
		// end vertex position
		[ 750, 560 ] ]
	});
	var progressBar = new iio.Line({
		// set position to app center
		// set color to green
		color : new iio.Color(254, 223, 158),
		// set width to 10px
		width : 6,
		// set vertices relative to pos
		vs : [
		// start vertex position
		[ 0, 560 ],
		// end vertex position
		[ 0, 560 ] ]
	});
	app.add(progressBarBg);
	app.add(progressBar);
	TimeControl.prototype.setProgressBar(progressBar);
}

module.exports = PokerIioController
